import { getCookie, setCookie } from "@/utils";
import { createSlice } from "@reduxjs/toolkit";

export const ProductNumData = createSlice({
  name: 'productNum',
  initialState: {
    value: getCookie('productNum') || 0
  },
  reducers: {
    saveProductNum: (state, action) => {
       state.value = action.payload      
       setCookie('productNum', action.payload) 
    }
  }
})

export const { saveProductNum } = ProductNumData.actions
export default ProductNumData.reducer 